/*
 * (C) 2012
 * Use struct : can copy array member directly
 */


#include <stdio.h>

#define	N	10

struct tag
{
	int a[N];
	int flag;
};

struct tag org, lemo, cour;

struct tag twofold(struct tag s)
{
	int i;
	for (i = 0; i < N; i++)
		s.a[i] *= 2;
	return s;
}

void print(struct tag* s)
{
	int i;
	for ( i = 0; i < N; i++)
		printf("%d ", s->a[i]);
	printf("\n");
}

int main()
{
	int i;
	for (i = 0; i < N; i++)
		org.a[i] = i + 1;
	org.flag = -1;
	printf("org is: ");
	print(&org);

	printf("double org is: ");
	lemo = twofold(org);
	print(&lemo);

	printf("derectly copy is: ");
	cour = lemo;
	print(&cour);

	return 0;
}
